/*
                    Listbox Class Definition
*/

#ifndef LISTBOX_H
#define LISTBOX_H

#include "SDL/SDL.h"
#include <string>
#include <vector>

#include "Button.h"
#include "Listitem.h"
#include "../Structs.h"
#include "../Functions.h"

#include "Widget.h"

using namespace std;

class Listbox : public Widget
{
      public:
             Listbox();
             ~Listbox();

             int Initialise(Point NewPosition, int iNewSize, string strNewFontFilepath, int iNewWidth, int iNewBackColour, SDL_Color NewForeColour);

             int HandleMouseDown(int iMouseX, int iMouseY);
             int HandleMouseMotion(int iMouseXREL, int iMouseYREL);

             int SetListItems(vector<string> ListItemNames);

             int BlitToSurface(SDL_Surface *screen);

             int BlitToFrame(SDL_Surface *surface, Point FramePosition);

             void setPosition(Point NewPosition);
             Point getPosition();

             string getSelectedItem();
             void setSelectedItem(string strNewSelected);

             void setExpanded(bool bNewExpanded);
             bool getExpanded();

      private:
              Point Position;

              SDL_Surface *Image;

              string strFontFilepath;
              int iSize; // Size of the font used by all list items

              bool bExpanded;

              int iWidth, iHeight;

              int iBackColour;

              vector<Listitem*> Listitems;

              int RefreshItemPositions();

              SDL_Color ForeColour;
};

#endif
